// import { version } from '../package.json'
const version = '1.0.0'

type StoreType = {
  name: 'todo' | 'note' | 'feedback',
  keyPath: string,
  autoIncrement?: boolean,
  indexes?: {
    name: string,
    keyPath: string,
  }[]
}

type DatabaseConfigType = {
  databaseName: string,
  version: number,
  stores: StoreType[],
}

const DATABASDE_CONFIG: DatabaseConfigType = {
  databaseName: 'simple-note',
  version: parseInt(version.replace(/\./g, '')),
  stores: [
    {
      name: 'todo',
      keyPath: 'id',
      autoIncrement: true,
      indexes: [
        {
          name: 'by-status',
          keyPath: 'status',
        }
      ]
    },
    {
      name: 'note',
      keyPath: 'id',
      autoIncrement: true,
      indexes: [
        {
          name: 'by-updateTime',
          keyPath: 'updateTime',
        }
      ]
    },
    {
      name: 'feedback',
      keyPath: 'id',
      autoIncrement: true
    }
  ]
}

console.log(DATABASDE_CONFIG)

export default DATABASDE_CONFIG

export type { DatabaseConfigType, StoreType }